package jdos.cpu.core_dynamic;

import jdos.cpu.CPU_Regs;
import jdos.cpu.CPU_Regs.Reg;
import jdos.hardware.Memory;
import jdos.hardware.RAM;
import jdos.misc.Log;

public class Helper extends CPU_Regs {
    static protected int prefixes = 0;
    static protected int opcode_index = 0;

    static protected final long[] AddrMaskTable={0x0000ffffl,0xffffffffl};
    static protected final int[] AddrMaskTable1={0x0000ffff,0xffffffff};
    
    protected static final int OPCODE_NONE=0x000;
    protected static final int OPCODE_0F=0x100;
    protected static final int OPCODE_SIZE=0x200;
    
    static final protected boolean CPU_TRAP_CHECK = true;
    static protected final boolean CPU_PIC_CHECK = true;

    public final static int RESULT_HANDLED = 0;
    public final static int RESULT_ILLEGAL_INSTRUCTION = 1;
    public final static int RESULT_CALLBACK = 2;
    public final static int RESULT_CONTINUE = 3;
    public final static int RESULT_RETURN = 4;
    public final static int RESULT_ANOTHER = 5;
    public final static int RESULT_JUMP = 6;
    public final static int RESULT_CONTINUE_SEG = 7;

    static public Reg getSreg(int which) {
        Reg _s = null;
		switch (which) {
		case 0x00: /* MOV Ew,ES */					_s = CPU_Regs.reg_esVal;					break;
		case 0x01: /* MOV Ew,CS */					_s = CPU_Regs.reg_csVal;					break;
		case 0x02: /* MOV Ew,SS */					_s = CPU_Regs.reg_ssVal;					break;
		case 0x03: /* MOV Ew,DS */					_s = CPU_Regs.reg_dsVal;					break;
		case 0x04: /* MOV Ew,FS */					_s = CPU_Regs.reg_fsVal;					break;
		case 0x05: /* MOV Ew,GS */					_s = CPU_Regs.reg_gsVal;					break;
		}
		return _s;
    }
}
